package com.asset.crm.domain;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@SuppressWarnings("serial")
@Table(name="action_field")
@Entity
public class ActionField implements Serializable {

	private Integer id;
	private String name;
	private String dataType;
	private String validationType;
	private ActionType actionType;
	private String render;
   
    private Set<ActionColumnPredefinedValue> actionColumnPredefinedValues;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="action_field_id_seq")
	@SequenceGenerator(name="action_field_id_seq",sequenceName="action_field_id_seq",allocationSize=1)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	@Column(name="name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Column(name="data_type")
	public String getDataType() {
		return dataType;
	}
	public void setDataType(String dataType) {
		this.dataType = dataType;
	}
	
	@Column(name="validation_type")
	public String getValidationType() {
		return validationType;
	}
	public void setValidationType(String validationType) {
		this.validationType = validationType;
	}
	
	@ManyToOne
	@JoinColumn(name="action_type_id")
	public ActionType getActionType() {
		return actionType;
	}
	public void setActionType(ActionType actionType) {
		this.actionType = actionType;
	}
	@Column(name="render")
	public String getRender() {
		return render;
	}
	public void setRender(String render) {
		this.render = render;
	}
	@OneToMany(mappedBy="actionFieldId",fetch=FetchType.EAGER)
	public Set<ActionColumnPredefinedValue> getActionColumnPredefinedValues() {
		return actionColumnPredefinedValues;
	}
	
	public void setActionColumnPredefinedValues(
			Set<ActionColumnPredefinedValue> actionColumnPredefinedValues) {
		this.actionColumnPredefinedValues = actionColumnPredefinedValues;
	}
	
	
}
